import {lazy} from "react"
import {Navigate} from 'react-router-dom'
import { FriendsO, HomeO, Search, SettingO } from '@react-vant/icons'
// 箭头函数省略花括号的前提是语句必须有return
const Home = lazy(()=>{return import("../pages/Home")})
const Shophome = lazy(()=>import("../pages/ShopHome"))
const Detail = lazy(()=>import("../pages/Detail"))
const ShopCar = lazy(()=>import("../pages/Shopcar"))
const Address = lazy(()=>import("../pages/Address"))
const Addaddress = lazy(()=>import("../pages/Addadress"))
const Onpull = lazy(()=>import("../pages/Onpull"))
export const homechild = [
    {
        path:"/home/shophome",
        element:<Shophome></Shophome>,
        tit:"首页",
        icon:<HomeO />
    },
    {
        path:"/home/shopcar",
        element:<ShopCar></ShopCar>,
        tit:"购物车",
        icon:<FriendsO/>
    },
    {
        path:"/home",
        element:<Navigate to="/home/shophome"></Navigate>
    }
]
const routerconfig = [
   {
       path:"/home",
       element:<Home></Home>,
       children:homechild
   },
   {
       path:"/detail/:id",
       element:<Detail></Detail>
   },
  
   {
        path:"/address",
        element:<Address></Address>
   }, 
   {
        path:"/addadress",
        element:<Addaddress></Addaddress>
   },
   {
        path:"/onpull",
        element:<Onpull></Onpull>
   },
   {
    path:"/",
    element : <Navigate to="/home"></Navigate>
   }
   // 在路由表里重定向要写到最后面


]
export default routerconfig